package org.budo.elasticsearch.jdbc.driver.statement;

import java.sql.PreparedStatement;
import java.sql.SQLException;

import org.budo.elasticsearch.jdbc.driver.BudoElasticsearchJdbcPreparedStatement;
import org.budo.jdbc.driver.resultset.impl.MapArrayResultSet;
import org.budo.jdbc.driver.statement.AbstractJdbcStatement;

/**
 * @author limingwei
 */
public class DESC_TABLE extends AbstractJdbcStatement {
    public DESC_TABLE(String sql) {
        this.setSql(sql);
    }

    @Override
    public void execute(PreparedStatement preparedStatement) throws SQLException {
        // 返回的列
        String[] columnNames = new String[] { "Field", "Type", "Null", "Key", "Default", "Extra" };
        MapArrayResultSet resultSet = new MapArrayResultSet(columnNames, null);

        ((BudoElasticsearchJdbcPreparedStatement) preparedStatement).setResultSet(resultSet);
    }
}